//
//  HomeCellDataView.m
//  GSBlockChain
//
//  Created by guoshikeji_a on 2018/11/20.
//  Copyright © 2018年 guoshikeji. All rights reserved.
//

#import "HomeCellDataView.h"

@implementation HomeCellDataView

+ (UIFont *)titleFont {
    return [UIFont systemFontOfSize:11 weight:UIFontWeightRegular];
}
+ (CGFloat)titleHeight {
    return [self titleFont].lineHeight+1.0;
}
+ (UIFont *)dataFont {
    return [UIFont systemFontOfSize:19 weight:UIFontWeightMedium];
}
+ (CGFloat)dataHeihgt {
    return [self dataFont].lineHeight+1.0;
}

- (instancetype)init
{
    self = [super init];
    if (self) {
        [self setupSubviews];
    }
    return self;
}

- (void)setupSubviews {
    self.titleLabel = [UILabel new];
    self.titleLabel.textColor = [UIColor qmui_colorWithHexString:@"#AEAEAE"];
    self.titleLabel.font = [self.class titleFont];
    self.titleLabel.adjustsFontSizeToFitWidth = true;
    [self addSubview:self.titleLabel];
    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.left.right.mas_equalTo(self);
        make.height.mas_equalTo([self.class titleHeight]);
    }];
    //
    self.dataLabel = [UILabel new];
    self.dataLabel.textColor = [UIColor qmui_colorWithHexString:@"#333333"];
    self.dataLabel.font = [self.class dataFont];
    self.dataLabel.adjustsFontSizeToFitWidth = true;
    [self addSubview:self.dataLabel];
    [self.dataLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.left.right.mas_equalTo(self);
        make.height.mas_equalTo([self.class dataHeihgt]);
    }];
}

- (void)setTitle:(NSString *)title {
    _title = title;
    self.titleLabel.text = title;
}
- (void)setData:(NSString *)data {
    _data = data;
    self.dataLabel.text = data;
}


+ (CGFloat)defaultHeight {
    CGFloat height = 0;
    height += [self titleHeight];
    height += 3.0;
    height += [self dataHeihgt];
    return height;
}

@end
